<?php
/**
 * Created by littleU.
 * User: littleU
 * Date: 2021-02-02
 * Time: 9:37
 */

namespace app\api\controller\v1\cms;


use app\api\controller\BaseController;
use app\api\service\Token as TokenService;
use app\api\service\Admin as AdminService;

class Admin extends BaseController
{
    public function getMenuByAdmin()
    {
        $uid = TokenService::getCurrentUid();
        $result = AdminService::getMenuByUid($uid);
        return $result;
    }

    public function getBasicInfoByAdmin()
    {
        $uid = TokenService::getCurrentUid();
        $result = AdminService::getBasicInfoByAdmin($uid);
        return $result;
    }

    public function setBasicInfoByAdmin()
    {
        $data = input('post.');
        $result = AdminService::setBasicInfoByAdmin($data);
        return $result;
    }

    public function setPasswordByAdmin()
    {
        $uid = TokenService::getCurrentUid();
        $data = input('post.');
        $result = AdminService::setPasswordByAdmin($data,$uid);
        return $result;
    }

    public function setDefaultPassword()
    {
        $data = input('post.');
        $result = AdminService::setDefaultPassword($data);
        return $result;
    }

    public function getAdminByCondition()
    {
        $data = input('post.');
        $result = (new AdminService())->getAdminByCondition($data);
        return $result;
    }
}